from .settings import *
import pymysql

pymysql.version_info=(1, 3, 13, "final", 0)
pymysql.install_as_MySQLdb()

DEBUG = True
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    },
    'earthquake': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'earthquake',
        'HOST': '10.128.238.58',
        'PORT': 3306,
        'USER': 'root',
        'PASSWORD': '506LAB@CIDP_fzxy',
    }
    # 'd_oracle': {
    #         'ENGINE': 'django.db.backends.oracle',
    #         'NAME': "pdbdc",
    #         'USER': 'dcguest',
    #         'PASSWORD': "dcguest4321",
    #         'HOST': "10.2.202.52",
    #         'PORT': '1521',
    #         # "OPTIONS":{"init_command":"SET default_storage_engine=INNODB;"}
    # },
    # 'd_mysql': {
    #     'ENGINE': 'django.db.backends.mysql',
    #     'NAME': "myPro",
    #     'USER': 'root',
    #     'PASSWORD': "w649193186",
    #     'HOST': "127.0.0.1",
    #     'PORT': '3306',
    #     # "OPTIONS":{"init_command":"SET default_storage_engine=INNODB;"}
    # }
}

# 设置数据库的路由规则方法
DATABASE_ROUTERS = ['server.database_router.DatabaseAppsRouter']

# 设置APP对应的数据库路由表，哪个app要连接哪个数据库，没有指定会用default那个。
DATABASE_APPS_MAPPING = {
    # example:
    #'app_name': 'database_name',
    'earthquake_station': 'earthquake',
    'default': 'default',
}

# DATABASES = {
#     'default': {
#         'ENGINE': 'django.db.backends.mysql',
#         'NAME': 'djangoadmin',
#         'USER':'root',
#         'PASSWORD': 'w649193186',  # 请换成自己的密码
#         'HOST': '127.0.0.1',   # 如果不能连接，改成localhost试下
#         'POST': '3306',
#     }
# }
# import dj_database_url
# DATABASES['default'] = dj_database_url.config(default='sqlite://db/sqlite3.db')